<?php
// this file contains the contents of the popup window
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Insert Contact Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script>
<script language="javascript" type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
<style type="text/css" src="../../../../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css"></style>
<link rel="stylesheet" href="css/friendly_buttons_tinymce.css" />

<script type="text/javascript">
 
var contactDialog = {
	local_ed : 'ed',
	init : function(ed) {
		contactDialog.local_ed = ed;
		tinyMCEPopup.resizeToInnerSize();
	},
	insert : function insertcontact(ed) {
	 
		// Try and remove existing style / blockquote
		tinyMCEPopup.execCommand('mceRemoveNode', false, null);
		 
		// set up variables to contain our input values
		var email = jQuery('#shortcode-dialog select#contact-email').val();		 
		 
		var output = '';
		
		// setup the output of our shortcode
		output = '[contact ';
			output += 'email=' + email;
			
		output += ']'+contactDialog.local_ed.selection.getContent() + '[/contact]';
		
		tinyMCEPopup.execCommand('mceReplaceContent', false, output);
		 
		// Return
		tinyMCEPopup.close();
	}
};
tinyMCEPopup.onInit.add(contactDialog.init, contactDialog);
 
</script>

</head>
<body>
	<div id="shortcode-dialog">
		<form action="/" method="get" accept-charset="utf-8">
			<div>
				<label for="contact-email">To Email</label>
				<input type="text" value="" Name="email"/>
			</div>
			<div>	
				<a href="javascript:contactDialog.insert(contactDialog.local_ed)" id="insert" style="display: block; line-height: 24px;">Insert</a>
			</div>
		</form>
	</div>
</body>
</html>